class ArtistsGenre < ActiveRecord::Base
  #Joins an artist to a genre
  belongs_to	:artist
  belongs_to	:genre

  #Callbacks
  after_create :create_edit

  #Validations
  validates_uniqueness_of :genre_id, :scope => :artist_id
  validates_associated :artist
  validates_associated :genre

  private

  #
  #
  def create_edit
    entry = Hash.new
    entry.store("linked genre", [self.genre.name])
    Edit.create_edit(entry, self.artist)
  end
end
